using System;
using System.Collections.Generic;
using System.Linq;
using Granite.Modeling;

namespace Rifts.Models.Definitions
{
	public class SkillDefinitionViewModelCollection : SimpleModelCollection<SkillDefinitionViewModel>
	{

		public string Name
		{
			get { return Get<string>("Name"); }
			set { Set(value, "Name"); }
		}

		public SkillDefinitionViewModel FindByName(string name)
		{
			return this.FirstOrDefault(s => s.Name == name);
		}

		public void RemoveAll(Func<SkillDefinitionViewModel, bool> predicate)
		{
			for (int i = Count - 1; i >= 0; i--)
			{
				if (predicate(this[i]))
					RemoveAt(i);
			}
		}
	}
}
